package com.langsotech.studio.service.presentation.my;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.emf.ecore.xmi.impl.XMIHelperImpl;
public class BasicXMIHelperImpl extends XMIHelperImpl {
	private PrefixAndUri prefixAndUri;
	public PrefixAndUri getPrefixAndUri() {
		return prefixAndUri;
	}
	public void setPrefixAndUri(PrefixAndUri prefixAndUri) {
		this.prefixAndUri = prefixAndUri;
	}
	public BasicXMIHelperImpl() {
		super();
	}
	public BasicXMIHelperImpl(XMLResource resource, PrefixAndUri prefixAndUri) {
		super(resource);
		this.prefixAndUri = prefixAndUri;
	}
	@Override
	public String getURI(String prefix) {
		if (prefixAndUri.getPrifix().equals(prefix))
			return prefixAndUri.getUri();
		return super.getURI(prefix);
	}
	@Override
	public String getQName(EClass c) {
		String result = super.getQName(c);
		if (result != null && result.startsWith(prefixAndUri.getPrifix() + ":"))
			return result.substring(prefixAndUri.getPrifix().length() + 1);
		return result;
	}
}
